package com.sky.controller.user;


import com.sky.result.Result;
import com.sky.service.EmailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/email")
@Tag(name = "邮箱相关接口")
public class EmailController {

    private final EmailService emailService;


    @Autowired
    public EmailController(EmailService emailService) {
        this.emailService = emailService;
    }
 

    /**
     * 发送邮箱验证码
     */
    @PostMapping("/sendEmail")
    @Operation(summary = "发送邮箱验证码")
    public Result<String> sendSimpleMail(@RequestParam(value = "emailReceiver") String emailReceiver) {
        log.info("发送邮箱验证码：{}", emailReceiver);
        String string =emailService.sendSimpleMail( emailReceiver);
        return Result.success(string);
    }
}